import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.util.Arrays;

class Animal{
    protected String name;
    protected int age;
    protected double weight;

    public Animal() {
    }

    public Animal(String name, int age, double weight) {
        this.name = name;
        this.age = age;
        this.weight = weight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public void eat(){
        System.out.println(this.name+ " 在吃饭！");
    }

    public void sleep(){
        System.out.println(this.name+" 在睡觉！");
    }
}

class Cat extends Animal{
    public Cat() {
    }

    public Cat(String name, int age, double weight) {
        super(name, age, weight);
    }
    public void mew(){
        System.out.println(this.name+" 喵~喵~喵~");
    }

    @Override
    public void eat(){
        System.out.println(this.name + " 在吃主人给的小零食~");
    }

    @Override
    public void sleep() {
        System.out.println(this.name+" 正在狗窝里呼呼大睡");
    }
}

class Bird extends Animal{
    public String color;
    public Bird() {
    }

    public Bird(String name, int age, double weight) {
        super(name, age, weight);
    }

    public void fly(){
        System.out.println(this.name+" 正在天空翱翔!");
    }

    public void eat(){
        System.out.println(this.name+ " 叼着一只肥美的大青虫");
    }

    public void sleep(){
        System.out.println(this.name+" 站在枝桠上睡大觉，沐浴着月光，微风吹拂着");
    }
}

class Shape{
    void draw(){
        System.out.println("画图");
    }
}

class Rectangle extends Shape{
    void draw(){
        System.out.println(" ⬜");
    }
}

class Circle extends Shape{
    void draw(){
        System.out.println(" ⚪");
    }
}

class Triangle extends Shape{
    void draw(){
        System.out.println(" 🔺");
    }
}

class Flowers extends Shape{
    void draw(){
        System.out.println("~❀~");
    }
}

public class Text {


    public static void main(String[] args) {
        Rectangle rect = new Rectangle();
        Circle cir = new Circle();
        Triangle tri = new Triangle();
        Flowers flower = new Flowers();

        Shape[] shapes = {flower,rect,flower,cir,flower,tri,flower,tri,flower,cir,flower,rect,flower};

        for(Shape shape : shapes){
           shape.draw();
        }
    }

    public static void main4(String[] args) {
        Animal animal1 = new Cat("Hello Kitty",1,7);
        animal1.sleep();
        animal1.eat();

        Animal animal2 = new Bird("AngryBird",3,5.5);
        animal2.sleep();
        animal2.eat();
    }
    public static Animal function(String type){
        if("鸟".equals(type)){
            return new Bird("AngryBird",3,5.5);
        }else{
            return new Cat("Hello Kitty",1,7);
        }

    }
    public static void main3(String[] args) {
        Animal animal1 = function("猫");
        animal1.sleep();
        animal1.eat();
        Animal animal2 = function("鸟");
        animal2.sleep();
        animal2.eat();
    }
    public static void function(Animal animal){
        animal.eat();
        animal.sleep();
    }
    public static void main2(String[] args) {
        Animal animal1 = new Cat("Hello Kitty",1,7);
        function(animal1);

        Animal animal2 = new Bird("AngryBird",3,5.5);
        function(animal2);
    }
    public static void main1(String[] args) {
        Animal animal1 = new Cat("Hello Kitty",1,7);
        animal1.sleep();
        animal1.eat();
        //animal1.mew(); 编译报错

        Animal animal2 = new Bird("AngryBird",3,5.5);
        animal2.eat();
        animal2.sleep();
    }
}



